package cn.tansanqinger.dao.sql.knowledge;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import cn.tansanqinger.dao.sql.IQueryKnowledgeSqlDao;
import cn.tansanqinger.pojo.Queryknowledge;

@Repository
public class QueryKnowledgeSqlDaoImpl {
	
	@Autowired
	private IQueryKnowledgeSqlDao dao;
	
	/**
	 * 添加信息
	 * @param course
	 * @return
	 */
	public int add(Queryknowledge object) {
		return dao.insert(object);
	}
	
	/**
	 * 查询信息
	 * @param cid
	 * @return
	 */
	public Queryknowledge selectOnt(int id) {
		return dao.selectById(id);
	}
	
	/**
	 * 查询信息
	 * @param kid
	 * @return
	 */
	public List<Queryknowledge> selectKid(int id) {
		QueryWrapper<Queryknowledge> queryWrapper = new QueryWrapper<Queryknowledge>();
		queryWrapper.lambda().eq(Queryknowledge::getKid, id);
		queryWrapper.lambda().eq(Queryknowledge::getQisdispose, 0);
		return dao.selectList(queryWrapper);
	}
	
	/**
	 * 修改状态
	 * @param cid
	 * @param isuse
	 * @return
	 */
	public int updateStatus(Queryknowledge object) {
		return dao.updateById(object);
	}
	
	/**
	 * 删除信息
	 * @param cid
	 * @return
	 */
	public int deleteOne(int id) {
		return dao.deleteById(id);
	}
	
	/**
	 * 修改信息
	 * @param user
	 * @return
	 */
	public int modification(Queryknowledge object) {
		return dao.updateById(object);
	}

}
